package xyz.scootaloo.oj.iq;

import java.util.*;

/**
 * @author flutterdash@qq.com
 * @since 2021/3/27 21:56
 */
public class M1611 {

    public int[] divingBoard(int shorter, int longer, int k) {
        if (k == 0)
            return new int[0];
        if (shorter == longer)
            return new int[] {shorter * k};
        Set<Integer> set = new HashSet<>();
        List<Integer> res = new ArrayList<>();
        for (int i = 0; i<=k; i++) {
            int shortCount = k - i;
            int sum = i * longer + shortCount * shorter;
            if (set.contains(sum))
                continue;
            set.add(sum);
            res.add(sum);
        }
        return res.stream().mapToInt(Integer::intValue).toArray();
    }

    public static void main(String[] args) {
        M1611 p = new M1611();
        System.out.println(Arrays.toString(p.divingBoard(1, 2, 3)));
    }

}
